<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta content="shanhe.me" name="Author"><title>JMeter Test Results</title><style type="text/css">

                * { margin: 0; padding: 0 }

                table.details tr th{
                    color: #ffffff;
                    font-weight: bold;
                    text-align:center;
                    background:#2674a6;
                    line-height:2em;
                }

                table.details tr:nth-child(odd){background:#FFFFFF;border:1px solid #CCC;line-height:2em;}
                table.details tr:nth-child(even){background:#EDF3FE;border:1px solid #CCC;line-height:2em;}
                table.details td{border:1px solid black;}
                .Failure {
                    font-weight:bold; color:red;
                }
                html{ width: 100%; height: 100%; background: #b4b4b4; font-size: 12px }
                body { width: 95%; height: 95%; margin: 0 auto; }
                table { border: none; border-collapse: collapse; table-layout: fixed;word-wrap:break-word;word-break:break-all; }
                #panel-wrap {position:relative;width: 100%;height: 100%;}
                td { vertical-align: baseline; font-size: 12px }

                #left-panel { position: absolute; left: 0; top: 0; bottom: 0; width: 30%; overflow: auto; background: #dee4ea }
                #left-panel li.navigation { font-weight: bold; cursor: default; color: #9da8b2; line-height: 18px; background-position: 12px 5px; background-repeat: no-repeat; padding: 0 0 0 25px; background-image: url() }
                #left-panel li.success { color: #565b60 }
                #left-panel li.failure { color: red }
                #left-panel li { list-style: none; color: black; cursor: pointer }
                #left-panel li.selected { background-repeat: repeat-x; color: white; background: url() }
                #left-panel div { line-height: 20px; background-position: 25px 3px; background-repeat: no-repeat; padding: 0 0 0 45px }
                #left-panel div.success { background-image: url() }
                #left-panel div.failure { background-image: url() }
                #left-panel div.detail { display: none }
                #right-panel { position: absolute; right: 0; top: 0; bottom: 0; left: 30%; overflow: auto; background: white }
                #right-panel .group { font-size: 12px; font-weight: bold; line-height: 16px; padding: 0 0 0 18px; counter-reset: assertion; background-repeat: repeat-x; background-image: url() }
                #right-panel .zebra { background-repeat: repeat; padding: 0 0 0 18px; background-image: url() }

                #right-panel .data { line-height: 19px; }
                #right-panel pre.data { white-space: pre }
                #right-panel pre_res.data { white-space: pre }
                #right-panel tbody.failure { color: red }
                #right-panel td.key { min-width: 108px }
                #right-panel td.delimiter { min-width: 18px }
                #right-panel td.assertion:before { counter-increment: assertion; content: counter(assertion) ". " }
                #right-panel td.assertion { color: black }
                #right-panel .trail { border-top: 1px solid #b4b4b4 }

            </style><script type="text/javascript">

                var onclick_li = (function() {
                    var last_selected = null;
                    return function(li) {
                        if( last_selected == li )
                            return;
                        if( last_selected )
                            last_selected.className = "";
                        last_selected = li;
                        last_selected.className = "selected";
                        document.getElementById("right-panel").innerHTML = last_selected.firstChild.nextSibling.innerHTML;
                        return false;
                    };
                })();

                var patch_timestamp = function() {
                    var spans = document.getElementsByTagName("span");
                    var len = spans.length;
                    for( var i = 0; i < len; ++i ) {
                        var span = spans[i];
                        if( "patch_timestamp" == span.className )
                            span.innerHTML = new Date( parseInt( span.innerHTML ) );
                    }
                };
                var res_data_json = function() {
                    var pres = document.getElementsByTagName("pre");
                    var len = pres.length;
                    for( var i = 0; i < len; ++i ) {
                        var pre = pre_res[i];
							alert
                            pre.innerTEXT = JSON.stringify(pre.innerHTML,null,2);;
                    }
                };
                var patch_navigation_class = (function() {

                    var set_class = function(el, flag) {
                        if(el) {
                            el.className += flag ? " success" : " failure";
                        }
                    };

                    var traverse = function(el, group_el, flag) {
                        while(1) {
                            if(el) {
                                if(el.className == 'navigation') {
                                    set_class(group_el, flag);
                                    group_el = el;
                                    flag = true;
                                } else {
                                    var o = el.firstChild;
                                    o = o ? o.className : null;
                                    flag = flag ? (o == 'success') : false;
                                }
                                el = el.nextSibling;
                            } else {
                                set_class(group_el, flag);
                                break;
                            }
                        }
                    };

                    return function() {
                        var o = document.getElementById("result-list");
                        o = o ? o.firstChild : null;
                        if(o)
                            traverse(o, null, true);
                    };
                })();
				
				//判断是否为jsonStr
				function isJSON(str) {
					if (typeof str == 'string') {
						try {
							var obj=JSON.parse(str);
							if(typeof obj == 'object' && obj ){
								return true;
							}else{
								return false;
							}

						} catch(e) {
							console.log('error：'+str+'!!!'+e);
							return false;
						}
					}
					console.log('It is not a string!')
				};

			   // 获取响应数据，通过遍历进行转换
			   var jsonFormat = function() {
					var pres = document.getElementsByClassName('json_data'); //获取元素集合
					var len = pres.length; //获取元素个数
					<!-- alert(len); -->
					// 遍历元素并转换为json
					for( var i = 0; i < len; ++i ) {
						var text = pres[i].innerText;
						if (isJSON(text)) {
						json = JSON.parse(text);
						<!-- alert(json); -->
						document.getElementsByClassName('json_data')[i].innerText= JSON.stringify(json, null, 2);
						}
						<!-- document.getElementsByClassName('json_data')[i].innerText= jsonFormat(text);	 -->
					}
					//获取json格式内容				
				};
				
				function load() {
                    patch_timestamp();
					res_data_json();
                    patch_navigation_class();
                    var o = document.getElementById("result-list");
                    o = o ? o.firstChild : null;
                    o = o ? o.nextSibling : null;
                    if(o)
                        onclick_li(o);
					jsonFormat();
                };
                function checkfailure() {
                    if (document.getElementById("bt").innerHTML == "查看失败") {
                        document.getElementById("bt").innerHTML = "查看全部";
                        var trs = document.getElementsByTagName("table")[1].getElementsByTagName('tr');
                        for( var i = 1; i < trs.length; i++ ) {
                            var tr = trs[i];
                            if( "Failure" != tr.className )
                                tr.style.display = 'none';
                        }
                    }else if(document.getElementById("bt").innerHTML == "查看全部") {
                        document.getElementById("bt").innerHTML = "查看失败";
                        var trs = document.getElementsByTagName("table")[1].getElementsByTagName('tr');
                        for( var i = 1; i < trs.length; i++ ) {
                            var tr = trs[i];
                            if( "Failure" != tr.className )
                                tr.style.display = '';
                        }
                    }
                };
				window.onload = load;
            </script></head><body><h2>Summary</h2><table width="100%" cellspacing="2" cellpadding="5" class="details" align="center"><tr valign="top"><th>执行总数</th><th>成功数</th><th>失败数</th><th>成功率</th><th>Average Time</th><th>Min Time</th><th>Max Time</th></tr><tr valign="top" class=""><td align="center">1</td><td align="center">1</td><td align="center">0</td><td align="center">100.00%</td><td align="center">1521 ms</td><td align="center">1521 ms</td><td align="center">1521 ms</td></tr></table><button style="float:right" onclick="checkfailure()" id="bt" class="button">查看失败</button><h2>Pages</h2><table width="100%" cellspacing="2" cellpadding="5" class="details" align="center"><tr valign="top"><th width="30%">接口</th><th>执行总数</th><th>失败</th><th>成功率</th><th>Average Time</th><th>Min Time</th><th>Max Time</th></tr><tr valign="top" class=""><td align="left">后台管理订单</td><td align="center">1</td><td align="center">0</td><td align="center">100.00%</td><td align="center">1521 ms</td><td align="center">1521 ms</td><td align="center">1521 ms</td></tr></table><h2>Details</h2><div id="panel-wrap"><div id="left-panel"><ol id="result-list"><li class="navigation">Thread: 企探接口1.0 1-1</li><li onclick="return onclick_li(this);"><div class="success">后台管理订单</div><div class="detail"><div class="group">Sampler</div><div class="zebra"><table><tr><td class="data key">Timestamp</td><td class="data delimiter">:</td><td class="data"><span class="patch_timestamp">1640492498730</span></td></tr><tr><td class="data key">Time</td><td class="data delimiter">:</td><td class="data">1521 ms</td></tr><tr><td class="data key">Latency</td><td class="data delimiter">:</td><td class="data">0 ms</td></tr><tr><td class="data key">Sample Count</td><td class="data delimiter">:</td><td class="data">1</td></tr><tr><td class="data key">Error Count</td><td class="data delimiter">:</td><td class="data">0</td></tr><tr><td class="data key">Response Code</td><td class="data delimiter">:</td><td class="data">200</td></tr><tr><td class="data key">Response Message</td><td class="data delimiter">:</td><td class="data">Number of samples in transaction : 3, number of failing samples : 0</td></tr></table></div><div class="trail"></div><div class="group">Request</div><div class="zebra"><table><tr><td class="data key">Request Headers</td><td class="data delimiter">:</td><td class="data"><pre class="data"></pre></td></tr><tr><td class="data key">Method/Url</td><td class="data delimiter">:</td><td class="data"><pre class="data"> </pre></td></tr><tr><td class="data key">Query String</td><td class="data delimiter">:</td><td class="data"><pre class="data"></pre></td></tr></table></div><div class="trail"></div><div class="group">Response</div><div class="zebra"><table><tr><td class="data key">Response Data</td><td class="data delimiter">:</td><td class="data"><pre class="json_data">Non-TEXT response data, cannot record: ()</pre></td></tr></table></div><div class="trail"></div></div></li></ol></div><div id="right-panel"></div></div></body></html>